package pkg

type Error struct {
	State int    `json:"state"`
	Code  string `json:"code"`
	Msg   string `json:"msg"`
}

func (e *Error) Error() string {
	return e.Msg
}

func EntityNotFound(m string) *Error {
	return &Error{State: 404, Code: "entity-not-found", Msg: m}
}

func BadRequest(m string) *Error {
	return &Error{State: 400, Code: "bad-request", Msg: m}
}

func Unexpected(m string) *Error {
	return &Error{State: 500, Code: "internal-server", Msg: m}
}
